package com.wx.mall.sys.controller;


import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.wx.mall.common.api.CommonResult;
import com.wx.mall.sys.service.IRolePermissionService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;

import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import javax.validation.constraints.NotNull;
import java.util.List;

/**
 * <p>
 *  前端控制器
 * </p>
 *
 * @author j
 * @since 2020-03-18
 */
@RestController
@RequestMapping("/role-permission")
@Api(tags = "角色权限中间表")
public class RolePermissionController {

    @Resource
    private IRolePermissionService service;


    @GetMapping("/getListByRole/{roleId}")
    @ApiOperation("得到角色的权限id集合")
    public CommonResult<List<Long>> getListByRole(@PathVariable("roleId") @NotNull(message = "不能为空") Long roleId){

List<Long> ids=service.getListByRole(roleId);

return CommonResult.success(ids);

    }

}

